//
//  WCDealOrderView.m
//  CBT
//
//  Created by apple on 2019/7/10.
//  Copyright © 2019 Mr.Zhang. All rights reserved.
//

#import "WCDealOrderView.h"

@interface WCDealOrderView ()
@property (nonatomic, weak) UIButton *weakBtn;
@end

@implementation WCDealOrderView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self createViews];
    }
    
    return self;
}

- (void)createViews {
    CGFloat widthSpace = (SCREEN_WIDTH - 110*3.0)/4.0;
    for (int i = 0; i < 3; i++) {
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
        btn.frame = CGRectMake(widthSpace + (110 + widthSpace) * i, 15, 110, 128);
        btn.backgroundColor = [UIColor whiteColor];
        btn.layer.cornerRadius = 5;
        btn.tag = 1000 + i;
        [self addSubview:btn];
        [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        if (i ==0) {
            self.weakBtn = btn;
            self.weakBtn.layer.shadowOffset = CGSizeMake(20, 20);
            self.weakBtn.layer.shadowColor  = DefaultOrangeColor.CGColor;
            self.weakBtn.borderColor = DefaultOrangeColor;
            self.weakBtn.borderWidth = 1;
        }
        
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.frame = CGRectMake(25, 29, 60, 70);
        imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"watch%02d",i+1]];
        if (i == 0) {
            self.firstIV = imageView;
        }
        else if (i == 1) {
            self.secondIV = imageView;
        }
        else {
            self.thirdIV = imageView;
        }
        [btn addSubview:imageView];
    }
}

- (void)btnClick:(UIButton *)sender {
    sender.selected = !sender.selected;
}

@end
